Lens Controller
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
api.LensControllerFocus Class Reference

This class provides an API for the Focus lens controller, a class for interfacing with the Focus lens controller over a serial port. More...

Public Member Functions

 __init__ (self, port)
 
 connect (self)
 Opens the serial connection to the lens controller.
 
 disconnect (self)
 Closes the serial connection to the lens controller.
 
 calc_modbus_crc (self, data)
 The Focus controller uses a 16-bit modbus crc to check the integrity of the data.
 
 transmit_and_receive (self, data, nof_bytes)
 Transmit data to the lens controller and receive a response.
 
 transmit_data (self, data)
 Transmit data to the lens controller and check if it was received.
 
 get_focus_position (self)
 Get the current focus position of the lens.
 
 focus_stop (self)
 Stop the focus motor.
 
 set_focus_speed (self, rpm)
 Set the speed of the focus motor.
 
 get_focus_speed (self)
 Get the speed of the focus motor.
 
 set_focus_position (self, position)
 Set the focus position of the lens.
 
 move_focus_position (self, steps)
 Move the focus position of the lens by an amount of steps.
 
 focus_near (self)
 Move the focus position of the lens to the near end.
 
 focus_far (self)
 Move the focus position of the lens to the far end.
 
 get_end_positions (self)
 Get the near and far end positions of the lens.
 

Public Attributes

 focus_speed
 
 port
 
 connection
 

Detailed Description

This class provides an API for the Focus lens controller, a class for interfacing with the Focus lens controller over a serial port.

It supports methods for moving the lens to the near and far end, getting and setting the current focus position and setting the speed of the focus motor.

Member Function Documentation

◆ calc_modbus_crc()

api.LensControllerFocus.calc_modbus_crc (   self,
  data 
)

The Focus controller uses a 16-bit modbus crc to check the integrity of the data.

This method calculates the crc and appends it to the data.

Parameters
[in]dataThe data to send.

◆ get_end_positions()

api.LensControllerFocus.get_end_positions (   self)

Get the near and far end positions of the lens.

Returns
The near and far end positions as a tuple.

◆ get_focus_position()

api.LensControllerFocus.get_focus_position (   self)

Get the current focus position of the lens.

This is an arbitrary value that is used to determine the current position of the lens. this value is always 0 directly after a power cycle. After moving the lens, the position is relative to the start position and can be negative. For absolute positioning move the lens to the near and far end and store the positions by calling get_end_positions.

Returns
The current focus position as an integer, -1 if there was an error.

◆ get_focus_speed()

api.LensControllerFocus.get_focus_speed (   self)

Get the speed of the focus motor.

Returns
The speed in revolutions per minute.

◆ move_focus_position()

api.LensControllerFocus.move_focus_position (   self,
  steps 
)

Move the focus position of the lens by an amount of steps.

Parameters
[in]stepsThe number of steps to move the lens.

◆ set_focus_position()

api.LensControllerFocus.set_focus_position (   self,
  position 
)

Set the focus position of the lens.

Parameters
[in]positionThe absolute position of the focus lens.

◆ set_focus_speed()

api.LensControllerFocus.set_focus_speed (   self,
  rpm 
)

Set the speed of the focus motor.

Parameters
[in]rpmThe speed in revolutions per minute.

◆ transmit_and_receive()

api.LensControllerFocus.transmit_and_receive (   self,
  data,
  nof_bytes 
)

Transmit data to the lens controller and receive a response.

Parameters
[in]dataThe data to send.
[in]nof_bytesThe number of bytes to receive.
Returns
True if the transmission was successful, False otherwise.

◆ transmit_data()

api.LensControllerFocus.transmit_data (   self,
  data 
)

Transmit data to the lens controller and check if it was received.

Parameters
[in]dataThe data to send.
Returns
True if the transmission was successful, False otherwise.

The documentation for this class was generated from the following file: